import request from '@/utils/request'

// 获取文章分类
export const getArticleCategory = () => request.get('/my/cate/list')

// 获取文章分类详情
export const getCategoryInfo = id => request.get(`/my/cate/info?id=${id}`)

// 增加文章分类
export const addArticleCategory = data => request.post('/my/cate/add', data)

// 删除文章分类
export const delArticleCategory = id => request.delete(`/my/cate/del?id=${id}`)

// 更新文章分类
export const editArticleCategory = data => request.put(`/my/cate/info?id=${data.id}`, data)

// 获取文章列表
export const getArticleList = params => request.get('/my/article/list', { params })

// 获取文章详情
export const getArticleInfo = id => request.get(`/my/article/info?id=${id}`)

// 发布文章
export const addArticle = data => request({
  url: '/my/article/add',
  method: 'post',
  headers: { 'Content-Type': 'multipart/form-data' },
  data
})

// 更新文章
export const updateArticle = data => request({
  url: '/my/article/info',
  method: 'put',
  headers: { 'Content-Type': 'multipart/form-data' },
  data
})

// 删除文章
export const delArticle = id => request.delete(`/my/article/info?id=${id}`)
